﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MpSoft.Web.Controls.Layouts
{
    public partial class LoadControl : System.Web.UI.UserControl
    {
        #region Var
        #endregion

        #region Medthod

        private void LoadUserControl()
        {
            try
            {
                this.Controls.Add(LoadControl("~/Controls/" + this.UserControl));
            }
            catch (HttpException ex)
            {
                Session["HomeMessError"] = ex.Message.ToString();
                Session["HomeMessError"] = Session["HomeMessError"].ToString() + "</br></br>" +
                    ex.StackTrace.ToString();
                this.Controls.Add(LoadControl("~/Controls/AllPage/Error.ascx"));
            }
        }

        public void BindControl()
        {
            LoadUserControl();
        }

        #endregion

        #region Event
       
        protected void Page_Load(object sender, EventArgs e)
        {
            BindControl();
        }

        #endregion
        
        #region Properties

        public string UserControl { set; get; }

        #endregion
    }
}